<?php
/**
 * Created by PhpStorm.
 * User: huanglintian
 * Date: 2019/6/21
 * Time: 17:06
 */
$data = require __DIR__ .'/data2.php';

$config = array(
    'app_id' => $data['app_id'],
    'app_secret' => $data['app_secret'],
);

require_once __DIR__ . "/wechat/jssdk.php";
require_once __DIR__ . "/include.php";

@$jssdk = new JSSDK($config['app_id'], $config['app_secret']);
$url = isset($_POST['url']) ? urldecode($_POST['url']) : '';

@$signPackage = $jssdk->GetSignPackage($url);
$rand = str_rand2(5);

$count = count(explode('.', $data['d4']));
$domain = 3 > $count ? str_rand2(6) . '.' . $data['d4'] : $data['d4'];
//$time = time();
$time = strtotime(date('Y-m-d H:0:0'));
//$rand = str_rand2(6);
$rand = 'uisksjjsl';
@$port = "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']);
$ad = $data['back_url'] ? "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']) . "&path=http://www.baidu.com" : $port;

$money = isset($_POST['money']) ? trim($_POST['money']) : 77.99;

$array = array (
    'config' =>
        array (
            'appId' => $signPackage['appId'],
            'nonceStr' => $signPackage['nonceStr'],
            'timestamp' => $signPackage['timestamp'],
            'signature' => $signPackage['signature'],
            'debug' => false,
            'jsApiList' =>
                array (
                    0 => 'onMenuShareTimeline',
                    1 => 'onMenuShareAppMessage',
                    2 => 'showMenuItems',
                    3 => 'hideMenuItems',
                ),
        ),
    'to_group' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_group2' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_group3' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_group4' => $data['back_url'] ?
        array (
            'title' => '揭秘七旬大爷10年换6个妻子，都离家出走内幕 真相令人震惊！',
            'desc' => '有37个好友正在看...',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/bt8.jpg",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&c_=vlzyno3&_i=aaakjfvftw",
            'link' => $ad,
        ) : array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_group5' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_group6' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_timeline' =>
        array (
            'title' => '华为5G上市成功派发现金红包',
            'desc' => $money.'￥',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/200-1.png",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&_c=wkeyjsodkv&_y=1561107902",
            'link' => $port,
        ),
    'to_timeline2' =>
        array (
            'title' => '13"',
            'desc' => ' ',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/logo3.jpg?td=1561107902",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&c_=vlb&_j=shuiffxbmq",
            'link' => $ad,
        ),
    'to_timeline3' =>
        array (
            'title' => '来按摩的女人要这么搞她们才舒服......',
            'desc' => '有17个好友正在看...',
            'imgUrl' => "http://{$data['d2']}/d/sharewx/images/bt8.jpg",
//            'link' => "http://{$data['d4']}/?ll=Ly9zLmFuYW4tY2hpbmEuY29t&c_=v2&_t=smklnnduft",
            'link' => $ad,
        ),
    'backup' => 'http://adrukou2.oss-cn-shenzhen.aliyuncs.com/xs2/xs-008.html',
    'c_backup' => 'https://sharewx.cdn.bcebos.com/js/cf.js?_=1561107902',
    'to_info' =>
        array (
            'ok_msg' => '由于参与人数过多，系统将在48小时内发放到您的微信钱包，请耐心等待<br/><br/>朋友圈信息不可删除<br/>否则无法核实用户信息<br/><font style="color:#19b417;">以免奖品发放失败！</font> ',
            'timeline_num' => 2,
            'alipay' => '',
            'after_share' => '',
        ),
    'quanno' => 2,
    'qunno' => 4,
);
header('Content-Type:application/json; charset=utf-8');
echo json_encode($array);